home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / Install_3.3 / ARexx / Install_Main.dopus5 < prev    next >
Text File  |  1997-06-01  |  20KB  |  721 lines

  1. /* $VER: Install_Main.dopus5 3.2 (01.06.97) © Frédéric Steinfels
  2. */
  3.  
  4. signal on BREAK_C
  5. signal on BREAK_D
  6. signal on BREAK_E
  7. signal on BREAK_F
  8. signal on HALT
  9. signal on IOERR
  10. signal on SYNTAX
  11. signal on FAILURE
  12. options failat 21
  13. options results
  14. parse arg arguments
  15.  
  16. Call Init
  17. address value PORT
  18.  
  19. lister query srch path
  20. srcp=result
  21.  
  22. lister query dsth path
  23. dstp=result
  24.  
  25. if ~open(prefs,PREFSFILE,'READ') then do
  26.     dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(15,'Unable to open') PREFSFILE || '"' GetCatStr(0,'Abort')
  27.     call CleanUP
  28.     Exit
  29. end
  30. ln=readln(prefs)
  31. Call Close(prefs)
  32. cnt=1
  33. do while cnt<15
  34.     s.cnt=substr(ln,cnt,1)
  35.     if s.cnt~=0 & s.cnt~=1 then do
  36.         dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(31,'Error while reading') PREFSFILE || '"' GetCatStr(0,'Abort')
  37.         call CleanUP
  38.         Exit
  39.     end
  40.     cnt=cnt+1
  41. end
  42. drop ln
  43. if s.10=0 & s.11=0 & s.12=0 & s.14=0 & (s.5~=0 | s.6~=0) then do
  44.     dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(32,'You must set more compare criteriums') || '"' GetCatStr(0,'Abort')
  45.     call CleanUP
  46.     Exit
  47. end    
  48.  
  49.  
  50. MYPORT='DOINMN.'||prgcnt
  51. SSPORT='DOINSS.'||prgcnt
  52. SDPORT='DOINSD.'||prgcnt
  53. VSPORT='DOINVS.'||prgcnt
  54. VDPORT='DOINVD.'||prgcnt
  55. RQPORT='DOINRQ.'||prgcnt
  56. EXPORT='DOINEX.'||prgcnt
  57.  
  58. SPORT.1=SSPORT
  59. SPORT.2=SDPORT
  60.  
  61. VPORT.1=VSPORT
  62. VPORT.2=VDPORT
  63.  
  64. MYID=0
  65. ID=''
  66. CMD=''
  67. ARG=''
  68. /*    ID  CMD
  69.     0        Main Program
  70.         0    abort
  71.     1        Source Scanner
  72.         0    abort
  73.         1    Directory
  74.         2    File
  75.         3    Directory complete
  76.     2        Destination Scanner
  77.         0    abort
  78.         1    Directory
  79.         2    File
  80.         3    Directory complete
  81.     3        Source CRC and Version scanner
  82.            0    abort
  83.     4        Destination CRC and Version scanner
  84.            0    abort
  85.        5        Requester
  86.            0    abort
  87.            1    Auot replace, destination file is delete protected
  88.            2    Auto replace, source file is delete protected
  89.            3    Standard requester
  90.            4    Requester without 'repl Source'
  91.            5   Requester without 'repl Dest'
  92.            6    Auto replace, Requester without 'repl Source' and destination file is delete protected
  93.            7    Auto replace, Requester without 'repl Dest' and source file is delete protected
  94.            8    Both files are delete protected
  95.        6        Executor
  96.            0    abort
  97. */
  98.  
  99. src=1
  100. dst=2
  101.  
  102.  
  103. MYPORTH=openport(MYPORT)
  104.  
  105. ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Scan.dopus5' PORT MYPORT SSPORT 1 SRCH '"' || SRCP || '"'
  106. ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Scan.dopus5' PORT MYPORT SDPORT 2 DSTH '"' || DSTP || '"'
  107. if s.1=1 then do
  108.     ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VSPORT 3 WRITECOM '"' || SRCP || '"'
  109. end
  110. else do
  111.     ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VSPORT 3 '"' || SRCP || '"'
  112. end
  113. if s.2=1 then do
  114.     ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VDPORT 4 WRITECOM '"' || DSTP || '"'
  115. end
  116. else do
  117.     ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VDPORT 4 '"' || DSTP || '"'
  118. end
  119. ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Execute.dopus5' PORT MYPORT EXPORT 5 '"' || SRCP || '"' '"' || DSTP || '"'
  120. ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Request.dopus5' PORT MYPORT EXPORT RQPORT 6 '"' || SRCP || '"' '"' || DSTP || '"'
  121.  
  122. Call WriteCh('CON',GetCatStr(56,'Waiting for subtasks') || ' ')
  123. do while POS(SSPORT,SHOW('p'))=0 | POS(SDPORT,SHOW('p'))=0 | POS(VSPORT,SHOW('p'))=0 | POS(VDPORT,SHOW('p'))=0 | POS(RQPORT,SHOW('p'))=0 | POS(EXPORT,SHOW('p'))=0
  124.     Call WriteCh('CON','.')
  125.     Call delay(5)
  126. end
  127. Call WriteLn('CON',' ' || GetCatStr(57,'ready'))
  128. Call WriteLn('CON',GetCatStr(33,'Initialized with portname') MYPORT)
  129.  
  130. cntp=1
  131. cntf=0
  132. p.path.cntp=''
  133. last.src=1
  134. last.dst=1
  135. idfiles=0
  136. reqfiles=0
  137.  
  138. do until CMD='0'
  139.     call waitpkt(MYPORT)
  140.     Packet=getpkt(MYPORT)
  141.     if Packet ~= null() then do
  142.         ln = getarg(Packet,0)
  143.         ID=substr(ln,1,1)
  144.         CMD=substr(ln,2,1)
  145.         ARG=substr(ln,3)
  146.         call CheckArg
  147.         IF ID=1 | ID=2 THEN DO
  148.             IF CMD=1 THEN DO
  149.                 parse var arg path2 '0a'x nump
  150.                 Call NewDir
  151.             end
  152.             IF CMD=2 THEN DO
  153.                 parse var arg name2 '0a'x nump '0a'x size2 '0a'x fdate2 '0a'x com2
  154.                 Call NewFile
  155.             end
  156.             IF CMD=3 THEN DO
  157.                 parse var arg nump
  158.                 Call DirComplete
  159.             end
  160.         end
  161.         IF ID=3 | ID=4 THEN DO
  162.             IF CMD=1 THEN DO
  163.                 parse var arg name2 '0a'x ps '0a'x com2
  164.                 Call UpdateFile
  165.                 idfiles=idfiles-1
  166.                 if idfiles=0 then do
  167.                     Call CheckEnd
  168.                 end
  169.             end
  170.         end
  171.         IF ID=6 THEN DO
  172.             IF CMD>0 THEN DO
  173.                 parse var arg ps
  174.                 nump=f.path.ps
  175.                 IF CMD=1 THEN DO
  176.                     say GetCatStr(34,'[REPL D]') makepath(p.path.nump,f.name.ps)
  177.                 end
  178.                 IF CMD=2 THEN DO
  179.                     say GetCatStr(35,'[REPL S]') makepath(p.path.nump,f.name.ps)
  180.                 end
  181.                 IF CMD=3 THEN DO
  182.                     say GetCatStr(36,'[SKIP A]') makepath(p.path.nump,f.name.ps)
  183.                 end
  184.                 Call DropFile
  185.                 reqfiles=reqfiles-1
  186.                 if reqfiles=0 then do
  187.                     Call CheckEnd
  188.                 end
  189.             end
  190.         end
  191.     end
  192. end
  193.  
  194. Call CleanUP
  195. exit
  196.  
  197.  
  198. DirComplete: /* Directory variables are not dropped yet */
  199. if nump=last.ID then do
  200.     dopus send SPORT.ID MYID || 2
  201.     last.ID='END'
  202.     call CheckEnd
  203. end
  204. return    
  205.  
  206.  
  207. CheckEnd:
  208. if last.1='END' & last.2='END' & idfiles=0 & reqfiles=0 then do
  209.     Call CleanUP
  210.     exit
  211. end
  212. return
  213.  
  214.  
  215. UpdateFile:
  216. if f.1.ok.ps=2 | f.2.ok.ps=2 then return
  217. ID=ID-2
  218. fdate2=f.ID.fdate.ps
  219. call ParseComment
  220. f.ID.crc.ps=crc2
  221. f.ID.vdate.ps=vdate2
  222. f.ID.base.ps=base2
  223. f.ID.ver.ps=ver2
  224. f.ID.rev.ps=rev2
  225. f.ID.info.ps=info2
  226. f.ID.com.ps=com3
  227. Call CheckComplete
  228. ID=ID+2
  229. return
  230.  
  231.  
  232. NewFile:
  233. if symbol('lf.nump.0')='LIT' then do
  234.     lf.nump.0=0
  235. end
  236. p2=LSEARCH(name2,lf.nump)
  237. if p2=-1 then do
  238.     cntf=cntf+1
  239.     ps=cntf
  240.     p2=(lf.nump.0)+1
  241.     lf.nump.0=p2
  242.     lf.nump.p2=name2
  243.     lf.nump.p2.num=ps
  244. end
  245. else do
  246.     ps=lf.nump.p2.num
  247. end
  248. if f.1.ok.ps=2 | f.2.ok.ps=2 then do
  249.     Call DropFile
  250.     return
  251. end
  252. call ParseComment
  253. f.name.ps=name2
  254. f.path.ps=nump
  255. f.ID.crc.ps=crc2
  256. f.ID.fdate.ps=fdate2
  257. f.ID.vdate.ps=vdate2
  258. f.ID.size.ps=size2
  259. f.ID.base.ps=base2
  260. f.ID.ver.ps=ver2
  261. f.ID.rev.ps=rev2
  262. f.ID.info.ps=info2
  263. f.ID.com.ps=com3
  264. if cdate2~=fdate2 then do
  265.     dopus send VPORT.ID MYID || 1 || p.path.nump || lf || name2 || lf || ps || lf || fdate2 || lf || com3
  266.     idfiles=idfiles+1
  267. end
  268. else do
  269.     Call CheckComplete
  270. end
  271. Return
  272.  
  273.  
  274.  
  275. NewDir:
  276. path2=makepath(p.path.nump,path2)
  277. if symbol('lp.nump.0')='LIT' then do
  278.     lp.nump.0=0
  279. end
  280. p2=LSEARCH(path2,lp.nump)
  281. if p2=-1 then do
  282.     cntp=cntp+1
  283.     ps=cntp
  284.     p2=(lp.nump.0)+1
  285.     lp.nump.0=p2
  286.     lp.nump.p2=path2
  287.     lp.nump.p2.num=ps
  288. end
  289. else do
  290.     ps=lp.nump.p2.num
  291. end
  292. /*p.path.0=cntp
  293. ps=LSEARCH(path2,p.path)
  294. IF ps=-1 then do
  295.     cntp=cntp+1
  296.     ps=cntp
  297. end*/
  298. p.path.ps=path2
  299. last.ID=ps
  300.     dopus send SPORT.ID MYID || 1 || path2 || lf || ps
  301. return
  302.  
  303.  
  304. CheckComplete:
  305. nump=f.path.ps
  306. if ID=1 then do
  307.     f.1.ok.ps=1
  308.     if f.2.ok.ps=1 then do
  309.         Call CompareFiles
  310.         f.1.ok.ps=2
  311.         f.2.ok.ps=2
  312.     end
  313.     else do
  314.         if ~exists(makepath(makepath(dstp,p.path.nump),name2)) then do
  315.             Call CompareFiles
  316.             f.1.ok.ps=2
  317.             f.2.ok.ps=2
  318.         end
  319.     end
  320. end
  321. if ID=2 then do
  322.     f.2.ok.ps=1
  323.     if f.1.ok.ps=1 then do
  324.         Call CompareFiles
  325.         f.1.ok.ps=2
  326.         f.2.ok.ps=2
  327.     end
  328.     else do
  329.         if ~exists(makepath(makepath(srcp,p.path.nump),name2)) then do
  330.             Call CompareFiles
  331.             f.1.ok.ps=2
  332.             f.2.ok.ps=2
  333.         end
  334.     end
  335. end
  336. return
  337.  
  338.  
  339. CompareFiles:
  340. /* Copy file to Destination ? */
  341. if f.1.ok.ps=1 & f.2.ok.ps~=1 then do
  342.     if s.8=1 then do
  343.         dopus send EXPORT MYID || 1 || p.path.nump || lf || name2
  344.         say GetCatStr(37,'[COPY D]') makepath(p.path.nump,name2)
  345.         /* Call DropFile */
  346.         return
  347.     end
  348.     else do
  349.         say GetCatStr(38,'[SKIP D]') makepath(p.path.nump,name2)
  350.         Call DropFile
  351.         return
  352.     end
  353. end
  354.  
  355. /* Copy file to Source ? */
  356. if f.1.ok.ps~=1 & f.2.ok.ps=1 then do
  357.     if s.7=1 then do
  358.         dopus send EXPORT MYID || 2 || p.path.nump || lf || name2
  359.         say GetCatStr(39,'[COPY S]') makepath(p.path.nump,name2)
  360.         /* Call DropFile */
  361.         return
  362.     end
  363.     else do
  364.         say GetCatStr(40,'[SKIP S]') makepath(p.path.nump,name2)
  365.         Call DropFile
  366.         return
  367.     end
  368. end
  369.  
  370. /* Both file exist ? */
  371. if f.1.ok.ps=1 & f.2.ok.ps=1 then do
  372.     if symbol('f.1.fdate.ps')='LIT' then do
  373.         if open('win','CON:280/183/747/370/SHELL/CLOSE/SHOWDIR/WAIT','WRITE') then do
  374.             Call writech('win',1 || lf || ps || lf || f.1.ok.ps || lf || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps)
  375.         end
  376.         Call Close('win')
  377.     end
  378.     if symbol('f.2.fdate.ps')='LIT' then do
  379.         if open('win','CON:280/183/747/370/SHELL/CLOSE/SHOWDIR/WAIT','WRITE') then do
  380.             Call writech('win',2 || lf || ps || lf || f.1.ok.ps || lf || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps)
  381.         end
  382.         Call Close('win')
  383.     end
  384.  
  385.     /* equal ? */
  386.     if f.1.crc.ps=f.2.crc.ps & f.1.size.ps=f.2.size.ps then do
  387.         say GetCatStr(41,'[SKIP= ]') makepath(p.path.nump,name2)
  388.         Call DropFile
  389.         return /* skip file */
  390.     end
  391.     /* is it an icon */
  392.     if UPPER(right(name2,5))='.INFO' then do
  393.         /* icon compare enabled ? */
  394.         if s.9=1 then do
  395.             say GetCatStr(42,'[SKIP.e]') makepath(p.path.nump,name2)
  396.             Call DropFile
  397.             return /* icon compare routine not implemented yet */
  398.         end
  399.         else do
  400.             say GetCatStr(43,'[SKIP. ]') makepath(p.path.nump,name2)
  401.             Call DropFile
  402.             return
  403.         end
  404.     end
  405.     
  406.     /* both file exist but replacing disabled ? */
  407.     if s.3=0 & s.4=0 then do
  408.         say GetCatStr(44,'[SKIPnr]') makepath(p.path.nump,name2)
  409.         Call DropFile
  410.         return
  411.     end
  412.         
  413.     
  414.     /* Overwrite the file on Destination ? */
  415.     if s.4=1 then do /* replace */
  416.         if s.6=1 then do /* auto replace */
  417.             if (f.1.base.ps=f.2.base.ps | s.13=0) & ((f.1.fdate.ps>f.2.fdate.ps) | s.11=0) & ((f.1.vdate.ps>f.2.vdate.ps) | s.12=0) & ((f.1.size.ps>f.2.size.ps) | s.10=0) & ((f.1.ver.ps>f.2.ver.ps | (f.1.ver.ps=f.2.ver.ps & f.1.rev.ps>f.2.rev.ps)) | s.14=0) then do
  418.                 if delete(makepath(makepath(dstp,p.path.nump),name2)) then do
  419.                     dopus send EXPORT MYID || 1 || p.path.nump || lf || name2
  420.                     say GetCatStr(34,'[REPL D]') makepath(p.path.nump,name2)
  421.                     Call DropFile
  422.                     return
  423.                 end
  424.                 else do
  425.                     reqfiles=reqfiles+1
  426.                     if s.3=1 then do
  427.                         dopus send RQPORT MYID || 1 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  428.                     end
  429.                     else do
  430.                         dopus send RQPORT MYID || 6 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  431.                     end
  432.                     say GetCatStr(45,'[ASKe D]') makepath(p.path.nump,name2)
  433.                     return
  434.                 end
  435.             end
  436.         end
  437.     end
  438.     
  439.     /* Overwrite the file on Source ? */
  440.     if s.3=1 then do /* replace */
  441.         if s.5=1 then do /* auto replace */
  442.             if (f.1.base.ps=f.2.base.ps | s.13=0) & ((f.2.fdate.ps>f.1.fdate.ps) | s.11=0) & ((f.2.vdate.ps>f.1.vdate.ps) | s.12=0) & ((f.2.size.ps>f.1.size.ps) | s.10=0) & ((f.2.ver.ps>f.1.ver.ps | (f.2.ver.ps=f.1.ver.ps & f.2.rev.ps>f.1.rev.ps)) | s.14=0) then do
  443.                 if delete(makepath(makepath(srcp,p.path.nump),name2)) then do
  444.                     dopus send EXPORT MYID || 2 || p.path.nump || lf || name2
  445.                     say GetCatStr(35,'[REPL S]') makepath(p.path.nump,name2)
  446.                     Call DropFile
  447.                     return
  448.                 end
  449.                 else do
  450.                     reqfiles=reqfiles+1
  451.                     if s.4=1 then do
  452.                         dopus send RQPORT MYID || 2 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  453.                     end
  454.                     else do
  455.                         dopus send RQPORT MYID || 7 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  456.                     end
  457.                     say GetCatStr(46,'[ASKe S]') makepath(p.path.nump,name2)
  458.                     return
  459.                 end
  460.             end
  461.         end
  462.     end    
  463.  
  464.     /* Both file exist but none of them is newer */
  465.  
  466.     /* Replacing on on both sides */
  467.     if s.3=1 & s.4=1 then do
  468.         reqfiles=reqfiles+1
  469.         dopus send RQPORT MYID || 3 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  470.         say GetCatStr(47,'[ASK   ]') makepath(p.path.nump,name2)
  471.         return
  472.     end    
  473.  
  474.     /* Replacing on on Destination */
  475.     if s.4=1 then do
  476.         reqfiles=reqfiles+1
  477.         dopus send RQPORT MYID || 4 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  478.         say GetCatStr(48,'[ASK  D]') makepath(p.path.nump,name2)
  479.         return
  480.     end    
  481.  
  482.     /* Replacing on on Source */
  483.     if s.3=1 then do
  484.         reqfiles=reqfiles+1
  485.         dopus send RQPORT MYID || 5 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf ||  f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
  486.         say GetCatStr(49,'[ASK  S]') makepath(p.path.nump,name2)
  487.         return
  488.     end    
  489.  
  490.     say GetCatStr(50,'[SKIP? ]') makepath(p.path.nump,name2)
  491.     Call DropFile
  492.     return
  493. end
  494. return
  495.  
  496.  
  497. DropFile:
  498. /*say GetCatStr(51,'+DROP  +') f.name.ps*/
  499. DROP f.name.ps f.1.size.ps f.2.size.ps f.1.fdate.ps f.2.fdate.ps f.1.crc.ps f.2.crc.ps f.1.vdate.ps f.2.vdate.ps f.1.base.ps f.2.base.ps f.1.ver.ps f.2.ver.ps f.1.rev.ps f.2.rev.ps f.1.info.ps f.2.info.ps f.1.com.ps f.2.com.ps f.path.ps
  500. return
  501.  
  502.  
  503. DropDir:
  504. /* Not implemented yet */
  505. return
  506.  
  507.  
  508. ParseComment:
  509. crc2=0
  510. vdate2=0
  511. cdate2=0
  512. base2=''
  513. ver2=0
  514. rev2=0
  515. info2=''
  516. com3=''
  517.  
  518. crc2=LEFT(com2,8)
  519. cdate2=SUBSTR(com2,9,8)
  520.  
  521. if COMPRESS(crc2,'0123456789ABCDEF') ~='' | COMPRESS(cdate2,'0123456789ABCDEF') ~='' | SUBSTR(com2,17,1)~=' ' then do
  522.     return
  523. end
  524. com2=substr(com2,17)
  525. cdate2=x2d(cdate2)
  526.  
  527. if POS('¸',com2)~=0 then do
  528.     parse var com2 ' ' com2 '¸' com3
  529. end
  530. else do
  531.     parse var com2 ' ' com2
  532. end
  533. rest=com2
  534. vdate2=0
  535.  
  536.  
  537. do while vdate2=0 & POS('(',rest)<POS(')',rest) & POS('(',rest)>0
  538.     parse var rest . '(' tdate ')' rest
  539.     if length(tdate)=10 then do
  540.         if substr(tdate,3,1)='.' & substr(tdate,6,1)='.' then do
  541.             q=POS(tdate,com2)
  542.             tdate=TRANSLATE(tdate,'0',' ')
  543.             com2=OVERLAY(tdate,com2,q,10)
  544.             vdate2=DATE('i',substr(tdate,7,4) || substr(tdate,4,2) || substr(tdate,1,2),'s')
  545.         end
  546.     end
  547. end
  548.  
  549. if vdate2~=0 then do
  550.     info2=substr(rest,2)
  551.     a=POS(' ',com2)
  552.     e=pos(tdate,com2)-3
  553.     q=LASTPOS('.',com2,e)
  554.     if q>a then do
  555.         a=lastpos(' ',com2,q)
  556.         ver2=substr(com2,a+1,q-a-1)
  557.         rev2=substr(com2,q+1,e-q)
  558.         base2=left(com2,a-1)
  559.     end
  560.     else do
  561.         base2=left(com2,e)
  562.     end
  563. end
  564. else do
  565.     q=pos('.',com2)
  566.     if q~=0 then do
  567.         do while lastpos(' ',com2,q)=0
  568.             q=pos('.',com2,q+1)
  569.             if q=0 then do
  570.                 base2=com2
  571.                 return
  572.             end
  573.         end
  574.         a=lastpos(' ',com2,q)+1
  575.         e=POS(' ',com2,a)-1
  576.         if e=-1 then e=LENGTH(com2)
  577.         ver2=substr(com2,a,q-a)
  578.         rev2=substr(com2,q+1,e-q)
  579.         base2=left(com2,a-2)
  580.         info2=substr(com2,e+2)
  581.     end
  582.     else do
  583.         base2=com2
  584.     end
  585. end
  586. return
  587.  
  588.  
  589.  
  590. CheckArg:
  591. IF DATATYPE(ID)~='NUM' | DATATYPE(CMD)~='NUM' THEN Call CheckArgFail
  592. IF ID=0 THEN Call CheckArgFail
  593. IF ID=1 & CMD>3 THEN Call CheckArgFail
  594. IF ID=2 & CMD>3 THEN Call CheckArgFail
  595. IF ID=3 & CMD>1 THEN Call CheckArgFail
  596. IF ID=4 & CMD>1 THEN Call CheckArgFail
  597. IF ID=5 & CMD>0 THEN Call CheckArgFail
  598. IF ID=6 & CMD>3 THEN Call CheckArgFail
  599. IF ID>6 THEN Call CheckArgFail
  600. RETURN
  601.  
  602.  
  603. CheckArgFail:
  604. address value PORT
  605. dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(52,'Invalid packet received') || lf || 'ID=' || ID || lf || 'CMD=' || CMD || lf || 'ARG=' || ARG || '"' GetCatStr(0,'Abort')
  606. Call CleanUP
  607. exit
  608.  
  609.  
  610.  
  611. CleanUp:
  612. if POS(MYPORT,SHOW('p'))~=0 then do
  613.     Call FORBID()
  614.     Call ClosePort(MYPORTH)
  615.     Call PERMIT()
  616. end
  617. If POS(SSPORT,SHOW('p'))~=0 then do
  618.     dopus send SSPORT MYID || 0
  619. end
  620. If POS(SDPORT,SHOW('p'))~=0 then do
  621.     dopus send SDPORT MYID || 0
  622. end
  623. If POS(VSPORT,SHOW('p'))~=0 then do
  624.     dopus send VSPORT MYID || 0
  625. end
  626. If POS(VDPORT,SHOW('p'))~=0 then do
  627.     dopus send VDPORT MYID || 0
  628. end
  629. If POS(RQPORT,SHOW('p'))~=0 then do
  630.     dopus send RQPORT MYID || 0
  631. end
  632. If POS(EXPORT,SHOW('p'))~=0 then do
  633.     dopus send EXPORT MYID || 0
  634. end
  635. Call CloseCatalog(catalog)
  636. Call Close('CON')
  637. return
  638.  
  639.  
  640.  
  641. Init:
  642. libname = "rexxdossupport.library"
  643. if ~show("L", libname) then do
  644.   if ~addlib(libname, 0, -30, 2) then do
  645.     say libname "not added!"
  646.     exit
  647.   end
  648. end
  649. libname = "rexxtricks.library"
  650. if ~show("L", libname) then do
  651.   if ~addlib(libname, 0, -30) then do
  652.     say libname "not added!"
  653.     exit
  654.   end
  655. end
  656. libname = "rexxsupport.library"
  657. if ~show("L", libname) then do
  658.   if ~addlib(libname, 0, -30) then do
  659.     say libname "not added!"
  660.     exit
  661.   end
  662. end
  663. libname = "locale.library"
  664. if ~show("L", libname) then do
  665.   if ~addlib(libname, 0, -30) then do
  666.     say libname "not added!"
  667.     exit
  668.   end
  669. end
  670. ProgramName = "Install_Main.dopus5";
  671. ArgsTemplate = "PORT/A,SRCH/A,DSTH/A,PRGCNT/A,PREFSFILE/A"
  672. lf='0a'x
  673. if strip(arguments) = '?' then do
  674.     Call WriteCh(STDOUT, ArgsTemplate || ': ')
  675. pull arguments
  676. end; else nop
  677. if ~ReadArgs(arguments,ArgsTemplate) then do
  678.     say Fault(RC,ProgramName)
  679.      exit 10
  680. end; else nop
  681. drop arguments
  682. catalog=opencatalog('Install.dopus5.catalog','english',0)
  683. if ~open('CON','CONSOLE:','WRITE') then do
  684.     dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(15,'Unable to open') 'CONSOLE:' || '"' GetCatStr(0,'Abort')
  685.     call CleanUP
  686.     Exit
  687. end
  688. return
  689.  
  690.  
  691.  
  692. ERROR:
  693. HALT:
  694. IOERR:
  695. SYNTAX:
  696. IF RC ~= 0 THEN DO
  697.  line=sigl
  698.  text=errortext(rc)
  699.  dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || text || lf || GetCatStr(19,'Line') line || '"' GetCatStr(0,'Abort')
  700. END
  701. else do
  702.  dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || '"' GetCatStr(0,'Abort')
  703. end
  704. BREAK_C:
  705. BREAK_D:
  706. BREAK_E:
  707. BREAK_F:
  708. Call CleanUP
  709. exit
  710.  
  711.  
  712. getcatstr: /* Thank you for this procedure, Edmund */
  713. parse arg msgno,msgstring
  714. if catalog~=0 then
  715.    msgstring=getcatalogstr(catalog,msgno,msgstring)
  716. do i=3 to arg()
  717.    parse var msgstring fore '%s' aft
  718.    msgstring=fore||arg(i)||aft
  719.    end
  720. return msgstring
  721.